import {createRouter,createWebHashHistory} from "vue-router"

const router = createRouter({
    mode: 'hash',
    history:createWebHashHistory(),
    base: process.env.BASE_URL,
    routes: [
        {
            path: '/',
            name: 'index',
            redirect:'/index',
            meta: { title: '首页' },
            component: () => 
                import ( /* webpackChunkName: 'Index' */ '@/pages/index')
        },
        {
            path: '/index',
            name: 'index',
            meta: { title: '首页' },
            component: () =>
                import ( /* webpackChunkName: 'Index' */ '@/pages/index')
        },
        {
            path: '/login',
            name: 'login',
            meta: { title: '登录页' },
            component: () =>
                import ( /* webpackChunkName: 'Login' */ '@/pages/login')
        },
        {
            path: '/goods',
            name: 'goods',
            component: () => import('@/pages/index'),
            redirect:'/goods/index',
            meta: { title: '商品' },
            children: [
              {
                path: '/goods/index',
                name: 'goods-index',
                component: () => import('@/pages/goods/list'),
                meta: { title: '商品列表' }
              },
              {
                path: '/goods/add',
                name: 'goods-add',
                component: () => import('@/pages/goods/add'),
                meta: { title: '新增商品' }
              }
            ]
        },{
            path: '/order',
            name: 'order',
            component: () => import('@/pages/index'),
            redirect:'/order/list',
            meta: { title: '订单' },
            children: [
              {
                path: '/order/list',
                name: 'order-list',
                component: () => import('@/pages/orders/list'),
                meta: { title: '订单列表' }
              }
            ]
        },
    ]
})

export default router
